package top.leyi.aop;

import org.aspectj.lang.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * @desc 用于记录每天访问人数的aop,人访问之后把访问的记录存到redis中，然后持久化到mysql中
 */
@Configuration
@Aspect
public class LogAop {
    @Autowired
    StringRedisTemplate redisTemplate;


    @Pointcut(value = "execution(public * top.leyi.IService.ITokenService.setToken(..))")
    public void welog(){

    }

    @After("welog()")
    public void doLog(){
      redisTemplate.opsForValue().increment("visitors");
    }
}
